package javabasics.exception;

import java.io.IOException;

public class ExcepyionDemo {
    public static void test3(){

        try{

            int a = 5/0;

        }finally{

            throw new RuntimeException("hello");

        }
    }

    public static void func() throws RuntimeException, NullPointerException {

        throw new RuntimeException("func exception");

    }

    public static void main(String[] args) {
//        test3();
        try {

            func();

        } catch (RuntimeException re) {

            re.printStackTrace();

        } catch (Exception ex) {

            ex.printStackTrace();

        }
    }

    public class Base {

        public void func() throws IOException {

            throw new IOException("Base IOException");

        }

    }

//    public class Sub extends Base {
//        //'func()' in 'javabasics.exception.ExcepyionDemo.Sub' clashes with 'func()' in 'javabasics.exception.ExcepyionDemo.Base'; overridden method does not throw 'java.lang.Exception'
//        public void func() throws Exception {
//
//            throw new Exception("Sub Exception");
//
//        }
//
//    }
}
